import request from '../utils/request'

export const getCode = (data) => {
  return request.post('/get/code', data)
}

export const userAuthentication = (data) => {
  return request.post('/user/authentication', data)
}
export const login = (data) => {
  return request.post('/login', data)
}

export const authAdmin = (params) => {
  const query = {
    pageNum: Number(params.pageNum).toString(), // 如：1 → "1"
    pageSize: Number(params.pageSize).toString(), // 如：10 → "10"
  };
  return request.get('/auth/admin', { params: query })
}

export const userGetmenu = () => {
  return request.get('/user/getmenu')
}

export const userSetmenu = (data) => {
  return request.post('/user/setmenu', data)
}

export const menuList = (params) => {
  const query = {
    pageNum: Number(params.pageNum).toString(), // 如：1 → "1"
    pageSize: Number(params.pageSize).toString(), // 如：10 → "10"
  };
  return request.get('/menu/list', { params: query })
}

export const menuSelectlist = () => {
  return request.get('/menu/selectlist')
}

export const updateUser = (data) => {
  return request.post('/update/user', data)
}

//用户菜单权限
export const menuPermissions = () => {
  return request.get('/menu/permissions')
}

//获取头像
export const photoList = () => {
  return request.get('/photo/list')
}

//创建陪护师
export const companion = (data) => {
  return request.post('/companion', data)
}

//请求陪护师数据
export const companionList = (params) => {
  const query = {
    pageNum: Number(params.pageNum).toString(), // 如：1 → "1"
    pageSize: Number(params.pageSize).toString(), // 如：10 → "10"
  };
  return request.get('/companion/list', { params: query })
}

//删除陪护师
export const deleteCompanion = (data) => {
  return request.post('/delete/companion', data)
}

//订单列表
export const adminOrder = (params) => {
  return request.get('/admin/order', { params })
}
//服务状态完成
export const updateOrder = (data) => {
  return request.post('/update/order', data)
}